import {BaseModel} from "@/model/BaseModel";

export enum SubQueueFlagEnum {
    // 普通
    PT = 1,
    // 预约
    YY = 2,
    // 回诊
    RZ = 3,
    // 复诊
    FZ = 4,
    // 急诊
    JZ = 5,
    // 绿通
    LT = 6,
    // VIP
    VIP = 7,
    // 军人
    JR = 8

}

export enum QueueStateEnum {
    // 待签到
    AWAIT_SIGN = 0,
    // 待叫号
    AWAIT_CALL,
    // 已叫号
    ALREADY_CALLED,
    // 已过号
    ALREADY_PASSED,
    // 待回诊
    AWAIT_REVIEW,
    // 已完成
    ALREADY_COMPLETED,
    // 已退号
    ALREADY_CANCELED
}

export enum QueueSourceEnum {
    // 医技门诊
    YJ_MZ = 'yj_mz',
    // 医技住院
    YJ_ZY = 'yj_zy',
    // 医技体检
    YJ_TJ = 'yj_tj',
    // 医技住院护理
    YJ_ZY_HL = 'yj_zy_hl',
    // 门记门诊
    MJ_MZ = 'mj_mz',
}

export enum ScheduleSignStateEnum {
    // 提前签到
    BEFORE = 1,
    // 准时签到
    JUST,
    // 超时签到
    AFTER ,
}

export enum VisitStateEnum {
    // 排队中
    AWAIT = 0,
    // 候诊中
    NEXT = 1,
    // 就诊中
    JUST = 2,
}

export class QueueItemModel extends BaseModel{
    /**
     * 主键
     */
    public id:string;

    /**
     * 患者姓名
     */

    public patientName:string;

    /**
     * 挂号科室ID
     */

    public departId:string;

    public departCode: string;

    public departName: string;

    /**
     * 挂号医生ID
     */

    public doctorId:string;

    public doctorCode: string;

    public doctorName: string;

    /**
     * 挂号类目ID
     */

    public categoryId:string;

    public categoryName: string;

    /**
     * 挂号科目ID
     */

    public itemId:string;

    public itemName: string;

    /**
     * 就诊诊室ID
     */

    public roomId:string;

    public roomName: string;

    /**
     * 患者就诊卡类型1，医保卡，2社保卡，3资费卡
     */

    public patientCardFlag:number;

    /**
     * 患者就诊卡号
     */

    public patientCardNo:string;

    /**
     * 患者ID
     */

    public patientId:string;

    public patientSex: string;

    public patientBirthday: string;

    /**
     * 0未预约，1已预约
     */

    public scheduleFlag:number;

    /**
     * 预约日期
     */

    public scheduleDate:Date;


    //预约签到状态,1: 提前签到， 2：准时签到， 3：过后签到
    public scheduleSignState: number;

    // 患者前面等待人数
    public await: number;

    //0: 排队中, 1:叫号候诊， 2:就诊中
    public visitState:number;

    /**
     * 预约时间段开始时间
     */

    public scheduleFromTime:string;

    /**
     * 预约时间段结束时间
     */

    public scheduleToTime:string;

    /**
     * 挂号ID
     */

    public registerId:string;

    /**
     * 挂号状态
     */

    public registerFlag:number;

    /**
     * 挂号时间
     */

    public registerTime:Date;

    /**
     * HIS系统挂号序号
     */

    public registerNo:string;

    /**
     * 0否，1是
     */

    public signFlag:number;

    /**
     * 签约医生ID
     */

    public signDoctorId:string;

    /**
     * 签约医生名称
     */

    public signDoctorName:string;

    /**
     * HIS系统签约医生ID
     */

    public signHisDoctorId:string;

    /**
     * 是否自动签到
     */

    public autoSiginFlag:number;

    /**
     * 科室下队列号
     */

    public departQueueNo:number;

    /**
     * 分类队列序号
     */

    public subQueueNo:number;

    /**
     * 队列序号
     */

    public queueNo:number;

    /**
     * 签到次数
     */

    public signCount:number;

    /**
     * 签到时间
     */

    public signTime:Date;

    /**
     * 呼叫次数，默认0
     */

    public callCount:number;

    /**
     * 呼叫时间
     */

    public callTime:Date;

    /**
     * 呼叫未响应次数，默认0
     */

    public missCount:number;

    /**
     * 呼叫未响应时间
     */

    public missTime:Date;

    /**
     * 患者证件类型,1身份证，2护照
     */

    public patientIdCardFlag:number;

    /**
     * 证件号
     */

    public patientIdCardNo:string;

    /**
     * 1:优先，2预约，3，回诊，9挂号，默认9
     */

    public subQueueFlag:number;


    /**
     * 状态
     */
    public state:number;

    /**
     * 当前是过号标志
     */
    public passedFlag: number;

    /**
     * 创建者
     */

    public createId:string;

    /**
     * 创建时间
     */

    public createTime:Date;

    /**
     * 更新者
     */

    public updateId:string;

    /**
     * 更新时间
     */

    public updateTime:Date;

    /**
     * 院区ID
     */

    public hospitalId:string;

    /**
     * 客户ID
     */

    public customerId:string;


    public static subQueueFlagArr: {label: string ,value: number, isDefault?: boolean, nick: string, type: 'success'|'primary'|'danger'|'warning'|'default'}[] = [
        {label: '普通', value: SubQueueFlagEnum.PT, nick: '普通', isDefault: true, type: 'default'},
        {label: '回诊', value: SubQueueFlagEnum.RZ, nick: '回诊', type: 'warning'},
        {label: '预约', value: SubQueueFlagEnum.YY, nick: '预', type: 'primary'},
        {label: '复诊', value: SubQueueFlagEnum.FZ, nick: '复诊', type: 'warning'},
        {label: '急诊', value: SubQueueFlagEnum.JZ, nick: '急诊', type: 'danger'},
        {label: '绿通', value: SubQueueFlagEnum.LT, nick: '绿通', type: 'success'},
        {label: 'VIP', value: SubQueueFlagEnum.VIP, nick: 'VIP', type: 'success'},
        {label: '军人', value: SubQueueFlagEnum.JR, nick: '军人', type: 'primary'},
    ]

    public static queueStatusArr: {label: string ,value: number, type: 'success'|'primary'|'danger'|'warning'|'info'}[] = [
        {label: '待签到', value: QueueStateEnum.AWAIT_SIGN, type: 'info'},
        {label: '待叫号', value: QueueStateEnum.AWAIT_CALL, type: 'primary'},
        {label: '已叫号', value: QueueStateEnum.ALREADY_CALLED, type: 'warning'},
        {label: '已过号', value: QueueStateEnum.ALREADY_PASSED, type: 'danger'},
        {label: '待回诊', value: QueueStateEnum.AWAIT_REVIEW,  type: 'primary'},
        {label: '已完成', value: QueueStateEnum.ALREADY_COMPLETED, type: 'success'},
        {label: '已退号', value: QueueStateEnum.ALREADY_CANCELED, type: 'warning'},
    ]

    public static queueSourceArr: {label: string ,value: string, type: 'info'}[] = [
        {label: '医技门诊', value: QueueSourceEnum.YJ_MZ, type: 'info'},
        {label: '医技住院', value: QueueSourceEnum.YJ_ZY, type: 'info'},
        {label: '医技体检', value: QueueSourceEnum.YJ_TJ, type: 'info'},
        {label: '医技住院护理', value: QueueSourceEnum.YJ_ZY_HL, type: 'info'},
        {label: '门记门诊', value: QueueSourceEnum.MJ_MZ, type: 'info'},
    ]

    public static scheduleSignStateArr: {label: string, value: number, type: 'success'|'warning'}[] = [
        {label: '早到', value: ScheduleSignStateEnum.BEFORE, type: 'warning'},
        {label: '准时', value: ScheduleSignStateEnum.JUST, type: 'success'},
        {label: '迟到', value: ScheduleSignStateEnum.AFTER, type: 'warning'},
    ]

    public static visitStateArr: {label: string, value: number, type: 'default'|'warning'|'success'}[] = [
        {label: '排', value: VisitStateEnum.AWAIT, type: 'default'},
        {label: '候', value: VisitStateEnum.NEXT, type: 'warning'},
        {label: '就', value: VisitStateEnum.JUST, type: 'success'},
    ]

    public static getQueueState(state: number) {
        return this.queueStatusArr.find(item => item.value === state)
    }

    public static getQueueFlag(subQueueFlag: number) {
        return this.subQueueFlagArr.find(item => item.value === subQueueFlag)
    }

    public static getScheduleSignState(signState: number) {
        return this.scheduleSignStateArr.find(item => item.value == signState)
    }


    public static getVisitState(visitState: number) {
        return this.visitStateArr.find(item => item.value == visitState)
    }
}